import { userAccountLogin } from '@/api/user'

export default {
  namespaced: true,
  state: {
    profile: {}
  },
  mutations: {
    setPrifle (state, profile) {
      state.profile = profile
    },
    // 清除的方法
    clearProfile (state) {
      state.profile = {}
    }
  },
  actions: {
    async asyncLogin (ctx, { account, password }) {
      const res = await userAccountLogin({ account, password })
      ctx.commit('setPrifle', res.data.result)
    }
  }
}
